<html>
<head><meta charset="utf-8"><title>Stabilizing pointer::set_ptr_value · t-libs · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/index.html">t-libs</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html">Stabilizing pointer::set_ptr_value</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="234748117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20pointer%3A%3Aset_ptr_value/near/234748117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> HeroicKatora <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html#234748117">(Apr 15 2021 at 20:34)</a>:</h4>
<p>Regarding <a href="https://github.com/rust-lang/rust/issues/75091">https://github.com/rust-lang/rust/issues/75091</a>.<br>
What steps are necessary to begin stabilizing this, what would be the best way to approach the open question?</p>



<a name="234829461"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20pointer%3A%3Aset_ptr_value/near/234829461" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mara <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html#234829461">(Apr 16 2021 at 10:26)</a>:</h4>
<p>I'm not sure this is ready for stabilization in its current state. It's quite an odd API, and both the name and documentation suggests that it modifies a pointer instead of creating a new one. And on thin pointers <code>a.set_ptr_value(b)</code> is just another way of writing <code>b</code>. To me it seems like this function is just a temporary placeholder until we have a proper way to deal with fat pointers.</p>



<a name="234872044"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20pointer%3A%3Aset_ptr_value/near/234872044" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Lokathor <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html#234872044">(Apr 16 2021 at 15:17)</a>:</h4>
<p>Yeah I kinda know what pointers are all about and I can confirm that it took me far longer than a few moments to come to grips with this method.</p>



<a name="234875238"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20pointer%3A%3Aset_ptr_value/near/234875238" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html#234875238">(Apr 16 2021 at 15:36)</a>:</h4>
<p>cc <span class="user-mention" data-user-id="219747">@Simon Sapin</span> another api that can be removed now that we have <a href="https://doc.rust-lang.org/nightly/core/ptr/fn.from_raw_parts.html">https://doc.rust-lang.org/nightly/core/ptr/fn.from_raw_parts.html</a> and <a href="https://doc.rust-lang.org/nightly/core/ptr/fn.metadata.html">https://doc.rust-lang.org/nightly/core/ptr/fn.metadata.html</a></p>



<a name="234875686"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20pointer%3A%3Aset_ptr_value/near/234875686" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Sapin <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html#234875686">(Apr 16 2021 at 15:39)</a>:</h4>
<p>Agreed. (Also <a href="https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.to_raw_parts">https://doc.rust-lang.org/nightly/std/primitive.pointer.html#method.to_raw_parts</a> which is convenience for <code>(self.cast::&lt;()&gt;(), metadata(self))</code>)</p>



<a name="234876191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20pointer%3A%3Aset_ptr_value/near/234876191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Simon Sapin <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html#234876191">(Apr 16 2021 at 15:42)</a>:</h4>
<p>Though the open question in <a href="https://github.com/rust-lang/rust/issues/75091">https://github.com/rust-lang/rust/issues/75091</a> is still relevant</p>



<a name="234938124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/219381-t-libs/topic/Stabilizing%20pointer%3A%3Aset_ptr_value/near/234938124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> HeroicKatora <a href="https://rust-lang.github.io/zulip_archive/stream/219381-t-libs/topic/Stabilizing.20pointer.3A.3Aset_ptr_value.html#234938124">(Apr 17 2021 at 00:06)</a>:</h4>
<p>However, consider that stabilizing the <code>{to,from}_raw_parts</code> method requires stabilizing the details of the <code>Pointee</code> trait—at least the bounds of its associated type— since it appears in the interface, while the composite <code>set_ptr_value</code> does not. I can totally understand the desire to have it be a value transform instead of a mutation though.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>